import http from '@/utils/http'
import type{ chaterType } from '../model/chat';

//获取所有聊天用户列表
export const getChatList = (selfId:string)=>{
    return http.get('/classes/Chats',{
        params:{
            where:{
                    $or:[
						{selfId},
						{otherId:selfId}
					]
            }
        }
    })
}

//获取单个聊天用户
export const getChatUser = (id:string)=>{
    return http.get(`/classes/Chats/${id}`)
}


//添加用户到聊天列表
export const addChatList = (data:chaterType)=>{
    return http.post('/classes/Chats',data)
}

export const updateChatList = (id:string,data:chaterType)=>{
    return http.put(`/classes/Chats/${id}`,data)
}

